package com.mohan.config;

import com.mohan.bean.Person;
import com.mohan.dao.BookDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
@ComponentScan("com.mohan.bean")
public class MainConfigAutoWrite {

    @Primary
    @Bean("bookDao2")
    public BookDao bookDao( ){
        BookDao bookDao = new BookDao();
        bookDao.setLable("2");
        return bookDao;
    }

    @Bean
    public Person person() {
        return new Person("modaren",18);
    }
}
